package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.itheima.mapper.DeptMapper;
import com.itheima.mapper.EmproleMapper;
import com.itheima.mapper.PermissionMapper;
import com.itheima.mapper.RoleMapper;
import com.itheima.pojo.Emprole;
import com.itheima.pojo.Permission;
import com.itheima.pojo.Role;
import com.itheima.service.EmproleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;


@Service
public class EmproleServiceImpl extends ServiceImpl<EmproleMapper, Emprole> implements EmproleService {
    @Autowired
    private EmproleMapper EmproleMapper;
    @Autowired
    private RoleMapper roleMapper;
    public List<Integer> listRoleIdsByEmployeeId(Integer employeeId) {
        LambdaQueryWrapper<Emprole> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Emprole::getEmpId, employeeId);
        return EmproleMapper.selectList(queryWrapper).stream()
                .map(Emprole::getRoleId)
                .collect(Collectors.toList());
    }
}
